
// Get the path of the currently running do-file
local do_file_path `c(pwd)'

// Change the working directory to the location of the do-file
cd "`do_file_path'"

clear

use "proc_data\ghs_built_pop2020-09-14.dta"

rename area_m2 ghs_area_m2

label variable built1975 "built up 1975 : GHS R2019A"
label variable built1990 "built up 1990 : GHS R2019A"
label variable built2000 "built up 2000 : GHS R2019A"
label variable built2015 "built up 2015 : GHS R2019A"

label variable pop1975 "Population 1975 : GHS R2019A"
label variable pop1990 "Population 1990 : GHS R2019A"
label variable pop2000 "Population 2000 : GHS R2019A"
label variable pop2015 "Population 2015 : GHS R2019A"

label variable ghs_area_m2 "Area of fishnet pixel for GHS calculations : Mollweide"

*label variable area_km2 "Area km"
drop gid_0 

save "proc_data\BUILT_POP.dta", replace

/***
** check country sums
collapse (sum) pop1975-pop2015, by(gid_0)

* plot with WDI pop... checked google looks OK *


clear
use "proc_data\ghs_ucdb_built_pop2020-11-09.dta"
rename *, lower

drop if missing(pop1975-b2015)

label variable b1975 "built up 1975 from center point : GHS UCDB R2019A"
label variable b1990 "built up 1990 from center point: GHS UCDB R2019A"
label variable b2000 "built up 2000 from center point: GHS UCDB R2019A"
label variable b2015 "built up 2015 from center point: GHS UCDB R2019A"

label variable p1975 "Population 1975 from center point : GHS UCDB R2019A"
label variable p1990 "Population 1990 from center point : GHS UCDB R2019A"
label variable p2000 "Population 2000 from center point : GHS UCDB R2019A"
label variable p2015 "Population 2015 from center point : GHS UCDB R2019A"

save "proc_data\UCDB_BUILTPOP.dta", replace
***/